const path = require('path');
const webpack = require("webpack");

// 转发接口
const proxyIp = 'http://192.168.1.105:4000';

module.exports = {
	// 输出目录
  	assetsDir: 'static',
    pages: {
        index: {
             entry: 'src/main.js',
             template: 'public/index.html',
             filename: 'index.html',
        },
    },
    productionSourceMap:false,//打包后不生成.map文件
    devServer: {// 环境配置
		host: 'localhost',
		port: 8080,
		https: false,
		hotOnly: false,
		open: true, //配置自动启动浏览器
		proxy: {// 配置多个代理(配置一个 proxy: 'http://localhost:4000' )
			'/api': {
				target: proxyIp,
				ws: true,
				changeOrigin: true,
                pathRewrite: {
                    '^/api': '/mock'
                }
			},
			'/foo': {
				target: proxyIp
			}
		}
	},
     //其他配置....
    configureWebpack: {
        plugins: [
        	// 使用环境变量配置
        	new webpack.DefinePlugin({
        		'process.env': {
        			MOD_FLAG: JSON.stringify(process.env.MOD_FLAG)
        		}
        	}),
        ]
    },
};